<%@ page contentType="text/html;charset=UTF-8" isELIgnored="false" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>

<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html>
<html>
<head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0,maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <title>用户管理</title>
</head>
<body>
<div id="app">
    <form action="/backend/user?action=listPage" method="post">
        <table border="0" cellspacing="0" cellpadding="0" >
            <tr>
                <td colspan="8">
                    <label>用户名：</label><input type="text" name="loginName">
                    <label>姓名：</label><input type="text" name="userName">
                    <button id="search" type="submit">搜索</button>
                </td>
            </tr>
        </table>
    </form>
    <table border="1" cellspacing="0" cellpadding="0">
        <tr>
            <th>编号</th>
            <th>用户名</th>
            <th>性别</th>
            <th>姓名</th>
            <th>邮箱</th>
            <th>联系方式</th>
            <th>权限</th>
            <th colspan="2">操作</th>
        </tr>
        <tbody>
        <c:forEach items="${userList}" var="user">
            <tr>
                <td>${user.id}</td>
                <td>${user.loginName}</td>
                <td>
                        ${user.changesex(user.sex)}
                </td>
                <td>${user.userName}</td>
                <td>${user.email}</td>
                <td>${user.mobile}</td>
                <td>
                        ${user.changetype(user.type)}
                </td>
                <td><a href="#">修改</a></td>
                <td><a href="/backend/user?action=deleteUser&id=${user.id}">删除</a></td>
            </tr>
        </c:forEach>
        </tbody>
        <tfoot>
        <tr>
            <td colspan="9" align="center">当前第
                <span class="curPage">
                    <%
                        int pageNum= (int) request.getAttribute("pageNum");
                    %>
                    <%=pageNum%>
                </span>
                页, 共
                <span class="pageCount">
                    <%
                        long pageCount= (long) request.getAttribute("pageCount");
                    %>
                    <%=pageCount%>
                </span>页
                <a href="/backend/user?action=listPage">首页</a>
                <a href="/backend/user?action=listPage&curPage=<%=pageNum-1%>">上一页</a>
                <a href="/backend/user?action=listPage&curPage=<%=pageNum+1%>">下一页
                </a>
                <a href="/backend/user?action=listPage">尾页</a>
            </td>
        </tr>
        </tfoot>
    </table>
</div>
</body>
</html>
